home *** CD-ROM | disk | FTP | other *** search
- #ifndef lint
- char yysccsid[] = "@(#)yaccpar 1.4 (Berkeley) 02/25/90";
- #endif
- #line 2 "make_func.y"
- #include <stdio.h>
- #include <ctype.h>
- #include <string.h>
- #include <fcntl.h>
- #include "lint.h"
- #include "config.h"
-
- #undef open
- #undef fopen
-
- #ifndef mac
- #define FUNC_SPEC "make list_funcs"
- #else
- #undef fopen
- #define FUNC_SPEC "list_funcs"
- #endif
- #define FUNC_TOKENS "efun_tokens.y"
- #define PRE_LANG "prelang.y"
- #define POST_LANG "postlang.y"
- #define THE_LANG "lang.y"
- #define BUFSIZ 1024
- #define NELEMS(arr) (sizeof arr / sizeof arr[0])
-
- #define MAX_FUNC 2048 /* If we need more than this we're in trouble! */
- int num_buff;
- /* For quick sort purposes : */
- char *key[MAX_FUNC], *buf[MAX_FUNC], has_token[MAX_FUNC];
-
- int min_arg = -1, limit_max = 0;
-
- /*
- * arg_types is the types of all arguments. A 0 is used as a delimiter,
- * marking next argument. An argument can have several types.
- */
- int arg_types[200], last_current_type;
- /*
- * Store the types of the current efun. They will be copied into the
- * arg_types list if they were not already there (to save memory).
- */
- #undef MAX_LOCAL
- #define MAX_LOCAL 20
- int curr_arg_types[MAX_LOCAL], curr_arg_type_size;
-
- void yyerror PROT((char *));
- int yylex();
- int yyparse();
- int ungetc PROT((int c, FILE *f));
- char *type_str PROT((int)), *etype PROT((int)), *etype1 PROT((int)),
- *ctype PROT((int));
- #ifndef toupper
- int toupper PROT((int));
- #endif
-
- void fatal(str)
- char *str;
- {
- fprintf(stderr, "%s", str);
- exit(1);
- }
-
- #line 63 "make_func.y"
- typedef union {
- int number;
- char *string;
- } YYSTYPE;
- #line 71 "y.tab.c"
- #define ID 257
- #define VOID 258
- #define INT 259
- #define STRING 260
- #define OBJECT 261
- #define MIXED 262
- #define UNKNOWN 263
- #define MAPPING 264
- #define DEFAULT 265
- #define YYERRCODE 256
- short yylhs[] = { -1,
- 0, 0, 7, 7, 8, 8, 9, 1, 1, 3,
- 3, 3, 3, 3, 3, 3, 2, 2, 2, 6,
- 5, 4, 4, 4,
- };
- short yylen[] = { 2,
- 0, 2, 1, 0, 3, 0, 8, 1, 2, 1,
- 1, 1, 1, 1, 1, 1, 0, 1, 3, 1,
- 1, 1, 3, 3,
- };
- short yydefred[] = { 1,
- 0, 10, 11, 12, 15, 13, 14, 16, 0, 0,
- 2, 0, 9, 3, 0, 0, 0, 21, 0, 0,
- 22, 18, 0, 0, 0, 0, 0, 24, 0, 19,
- 0, 23, 5, 7,
- };
- short yydgoto[] = { 1,
- 18, 19, 10, 20, 21, 22, 15, 26, 11,
- };
- short yysindex[] = { 0,
- -251, 0, 0, 0, 0, 0, 0, 0, -243, -27,
- 0, -240, 0, 0, -22, -30, -26, 0, -38, -105,
- 0, 0, -25, -36, -30, -18, -251, 0, -233, 0,
- -34, 0, 0, 0,
- };
- short yyrindex[] = { 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, -41,
- 0, -14, 0, 0, 0, -40, 0, 0, -13, -39,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,
- };
- short yygindex[] = { 0,
- 26, 0, 0, 0, 2, 5, 0, 0, 0,
- };
- #define YYTABLESIZE 234
- short yytable[] = { 8,
- 17, 20, 8, 17, 20, 25, 2, 3, 4, 5,
- 6, 7, 8, 12, 13, 17, 14, 16, 27, 23,
- 28, 29, 31, 33, 34, 4, 9, 6, 32, 30,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 8, 0, 0, 0, 0,
- 0, 0, 0, 8, 17, 20, 24, 2, 3, 4,
- 5, 6, 7, 8,
- };
- short yycheck[] = { 41,
- 41, 41, 44, 44, 44, 44, 258, 259, 260, 261,
- 262, 263, 264, 257, 42, 46, 257, 40, 124, 46,
- 46, 58, 41, 257, 59, 40, 1, 41, 27, 25,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 124, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 257, -1, -1, -1, -1,
- -1, -1, -1, 265, 265, 265, 265, 258, 259, 260,
- 261, 262, 263, 264,
- };
- #define YYFINAL 1
- #ifndef YYDEBUG
- #define YYDEBUG 0
- #endif
- #define YYMAXTOKEN 265
- #if YYDEBUG
- char *yyname[] = {
- "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,"'('","')'","'*'",0,"','",0,"'.'",0,0,0,0,0,0,0,0,0,0,0,"':'","';'",
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- "ID","VOID","INT","STRING","OBJECT","MIXED","UNKNOWN","MAPPING","DEFAULT",
- };
- char *yyrule[] = {
- "$accept : funcs",
- "funcs :",
- "funcs : funcs func",
- "optional_ID : ID",
- "optional_ID :",
- "optional_default : DEFAULT ':' ID",
- "optional_default :",
- "func : type ID optional_ID '(' arg_list optional_default ')' ';'",
- "type : basic",
- "type : basic '*'",
- "basic : VOID",
- "basic : INT",
- "basic : STRING",
- "basic : MIXED",
- "basic : UNKNOWN",
- "basic : OBJECT",
- "basic : MAPPING",
- "arg_list :",
- "arg_list : typel2",
- "arg_list : arg_list ',' typel2",
- "typel2 : typel",
- "arg_type : type",
- "typel : arg_type",
- "typel : typel '|' arg_type",
- "typel : '.' '.' '.'",
- };
- #endif
- #define yyclearin (yychar=(-1))
- #define yyerrok (yyerrflag=0)
- #ifndef YYSTACKSIZE
- #ifdef YYMAXDEPTH
- #define YYSTACKSIZE YYMAXDEPTH
- #else
- #define YYSTACKSIZE 300
- #endif
- #endif
- int yydebug;
- int yynerrs;
- int yyerrflag;
- int yychar;
- short *yyssp;
- YYSTYPE *yyvsp;
- YYSTYPE yyval;
- YYSTYPE yylval;
- #define yystacksize YYSTACKSIZE
- short yyss[YYSTACKSIZE];
- YYSTYPE yyvs[YYSTACKSIZE];
- #line 175 "make_func.y"
-
- struct type {
- char *name;
- int num;
- } types[] = {
- { "void", VOID },
- { "int", INT },
- { "string", STRING },
- { "object", OBJECT },
- { "mixed", MIXED },
- { "unknown", UNKNOWN },
- { "mapping", MAPPING }
- };
-
- FILE *f;
- int current_line = 1;
-
- int main(argc, argv)
- int argc;
- char **argv;
- {
- int i, fdr, fdw;
- char buffer[BUFSIZ + 1];
-
- #ifdef mac
- #pragma unused(argc,argv)
- #endif
-
- #ifndef mac
- if ((f = (FILE *)popen(FUNC_SPEC, "r")) == NULL) {
- #else
- if ((f = (FILE *)fopen(FUNC_SPEC, "r")) == NULL) {
- #endif
- perror(FUNC_SPEC);
- exit(1);
- }
- yyparse();
- /* Now sort the main_list */
- for (i = 0; i < num_buff; i++) {
- int j;
- for (j = 0; j < i; j++)
- if (strcmp(key[i], key[j]) < 0) {
- char *tmp;
- int tmpi;
- tmp = key[i]; key[i] = key[j]; key[j] = tmp;
- tmp = buf[i]; buf[i] = buf[j]; buf[j] = tmp;
- tmpi = has_token[i];
- has_token[i] = has_token[j]; has_token[j] = tmpi;
- }
- }
- /* Now display it... */
- printf("{\n");
- for (i = 0; i < num_buff; i++)
- printf("%s", buf[i]);
- printf("\n};\nint efun_arg_types[] = {\n");
- for (i=0; i < last_current_type; i++) {
- if (arg_types[i] == 0)
- printf("0,\n");
- else
- printf("%s,", ctype(arg_types[i]));
- }
- printf("};\n");
- #ifndef mac
- pclose(f);
- #else
- fclose(f);
- #endif
- /*
- * Write all the tokens out. Do this by copying the
- * pre-include portion of lang.y to lang.y, appending
- * this information, then appending the post-include
- * portion of lang.y. It's done this way because I don't
- * know how to get YACC to #include %token files. *grin*
- */
- if ((fdr = open(PRE_LANG, O_RDONLY)) < 0) {
- perror(PRE_LANG);
- exit(1);
- }
- unlink(THE_LANG);
- #ifndef mac
- if ((fdw = open(THE_LANG, O_CREAT | O_WRONLY, 0444)) < 0) {
- #else
- if ((fdw = open(THE_LANG, O_CREAT | O_WRONLY)) < 0) {
- #endif
- perror(THE_LANG);
- exit(1);
- }
- while (i = read(fdr, buffer, BUFSIZ))
- write(fdw, buffer, i);
- close(fdr);
- for (i = 0; i < num_buff; i++) {
- if (has_token[i]) {
- char *str; /* It's okay to mung key[*] now */
- for (str = key[i]; *str; str++)
- if (islower(*str)) *str = toupper(*str);
- sprintf(buffer, "%%token F_%s\n", key[i]);
- write(fdw, buffer, strlen(buffer));
- }
- }
- if ((fdr = open(POST_LANG, O_RDONLY)) < 0) {
- perror(POST_LANG);
- exit(1);
- }
- while (i = read(fdr, buffer, BUFSIZ))
- write(fdw, buffer, i);
- close(fdr), close(fdw);
- return 0;
- }
-
- void yyerror(str)
- char *str;
- {
- fprintf(stderr, "%s:%d: %s\n", FUNC_SPEC, current_line, str);
- exit(1);
- }
-
- int ident(c)
- int c;
- {
- char buff[100];
- int len, i;
-
- for (len=0; isalnum(c) || c == '_'; c = getc(f)) {
- buff[len++] = c;
- if (len + 1 >= sizeof buff)
- fatal("Local buffer in ident() too small!\n");
- if (len == sizeof buff - 1) {
- yyerror("Too long indentifier");
- break;
- }
- }
- (void)ungetc(c, f);
- buff[len] = '\0';
- for (i=0; i < NELEMS(types); i++) {
- if (strcmp(buff, types[i].name) == 0) {
- yylval.number = types[i].num;
- return types[i].num;
- }
- }
- if (strcmp(buff, "default") == 0)
- return DEFAULT;
- yylval.string = malloc(strlen(buff)+1);
- strcpy(yylval.string, buff);
- return ID;
- }
-
- char *type_str(n)
- int n;
- {
- int i, type = n & 0xffff;
-
- for (i=0; i < NELEMS(types); i++) {
- if (types[i].num == type) {
- if (n & 0x10000) {
- static char buff[100];
- if (strlen(types[i].name) + 3 > sizeof buff)
- fatal("Local buffer too small in type_str()!\n");
- sprintf(buff, "%s *", types[i].name);
- return buff;
- }
- return types[i].name;
- }
- }
- return "What ?";
- }
-
- int yylex1() {
- register int c;
-
- for(;;) {
- switch(c = getc(f)) {
- case ' ':
- case '\t':
- continue;
- case '#':
- {
- #ifdef sun /* no prototype in <stdio.h> *sigh* */
- extern int fscanf PROT((FILE *, char *, ...));
- #endif
- int line;
- char file[2048]; /* does any operating system support
- longer pathnames? */
- if ( fscanf(f,"%d \"%s\"",&line,file ) == 2 )
- current_line = line;
- while(c != '\n' && c != EOF)
- c = getc(f);
- current_line++;
- continue;
- }
- case '\n':
- current_line++;
- continue;
- case EOF:
- return -1;
- default:
- if (isalpha(c))
- return ident(c);
- return c;
- }
- }
- }
-
- int yylex() {
- return yylex1();
- }
-
- char *etype1(n)
- int n;
- {
- if (n & 0x10000)
- return "T_POINTER";
- switch(n) {
- case INT:
- return "T_NUMBER";
- case OBJECT:
- return "T_OBJECT";
- case STRING:
- return "T_STRING";
- case MAPPING:
- return "T_MAPPING";
- case MIXED:
- return "0"; /* 0 means any type */
- default:
- yyerror("Illegal type for argument");
- }
- return "What ?";
- }
-
- char *etype(n)
- int n;
- {
- int i;
- int local_size = 100;
- char *buff = malloc(local_size);
-
- for (i=0; i < curr_arg_type_size; i++) {
- if (n == 0)
- break;
- if (curr_arg_types[i] == 0)
- n--;
- }
- if (i == curr_arg_type_size || curr_arg_types[i] == 0)
- return "0";
- buff[0] = '\0';
- for(; curr_arg_types[i] != 0; i++) {
- char *p;
- if (curr_arg_types[i] == VOID)
- continue;
- if (buff[0] != '\0')
- strcat(buff, "|");
- p = etype1(curr_arg_types[i]);
- /*
- * The number 2 below is to include the zero-byte and the next
- * '|' (which may not come).
- */
- if (strlen(p) + strlen(buff) + 2 > local_size) {
- fprintf(stderr, "Buffer overflow!\n");
- exit(1);
- }
- strcat(buff, etype1(curr_arg_types[i]));
- }
- return buff;
- }
-
- char *ctype(n)
- int n;
- {
- static char buff[100]; /* 100 is such a comfortable size :-) */
- char *p;
-
- if (n & 0x10000)
- strcpy(buff, "TYPE_MOD_POINTER|");
- else
- buff[0] = '\0';
- n &= ~0x10000;
- switch(n) {
- case VOID: p = "TYPE_VOID"; break;
- case STRING: p = "TYPE_STRING"; break;
- case INT: p = "TYPE_NUMBER"; break;
- case OBJECT: p = "TYPE_OBJECT"; break;
- case MIXED: p = "TYPE_ANY"; break;
- case MAPPING: p = "TYPE_MAPPING"; break;
- case UNKNOWN: p = "TYPE_UNKNOWN"; break;
- default: yyerror("Bad type!");
- }
- strcat(buff, p);
- if (strlen(buff) + 1 > sizeof buff)
- fatal("Local buffer overwritten in ctype()");
- return buff;
- }
- #line 524 "y.tab.c"
- #define YYABORT goto yyabort
- #define YYACCEPT goto yyaccept
- #define YYERROR goto yyerrlab
- int
- yyparse()
- {
- register int yym, yyn, yystate;
- #if YYDEBUG
- register char *yys;
- extern char *getenv();
-
- if (yys = getenv("YYDEBUG"))
- {
- yyn = *yys;
- if (yyn >= '0' && yyn <= '9')
- yydebug = yyn - '0';
- }
- #endif
-
- yynerrs = 0;
- yyerrflag = 0;
- yychar = (-1);
-
- yyssp = yyss;
- yyvsp = yyvs;
- *yyssp = yystate = 0;
-
- yyloop:
- if (yyn = yydefred[yystate]) goto yyreduce;
- if (yychar < 0)
- {
- if ((yychar = yylex()) < 0) yychar = 0;
- #if YYDEBUG
- if (yydebug)
- {
- yys = 0;
- if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
- if (!yys) yys = "illegal-symbol";
- printf("yydebug: state %d, reading %d (%s)\n", yystate,
- yychar, yys);
- }
- #endif
- }
- if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
- #if YYDEBUG
- if (yydebug)
- printf("yydebug: state %d, shifting to state %d\n",
- yystate, yytable[yyn]);
- #endif
- if (yyssp >= yyss + yystacksize - 1)
- {
- goto yyoverflow;
- }
- *++yyssp = yystate = yytable[yyn];
- *++yyvsp = yylval;
- yychar = (-1);
- if (yyerrflag > 0) --yyerrflag;
- goto yyloop;
- }
- if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
- yyn = yytable[yyn];
- goto yyreduce;
- }
- if (yyerrflag) goto yyinrecovery;
- #ifdef lint
- goto yynewerror;
- #endif
- yynewerror:
- yyerror("syntax error");
- #ifdef lint
- goto yyerrlab;
- #endif
- yyerrlab:
- ++yynerrs;
- yyinrecovery:
- if (yyerrflag < 3)
- {
- yyerrflag = 3;
- for (;;)
- {
- if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
- {
- #if YYDEBUG
- if (yydebug)
- printf("yydebug: state %d, error recovery shifting\
- to state %d\n", *yyssp, yytable[yyn]);
- #endif
- if (yyssp >= yyss + yystacksize - 1)
- {
- goto yyoverflow;
- }
- *++yyssp = yystate = yytable[yyn];
- *++yyvsp = yylval;
- goto yyloop;
- }
- else
- {
- #if YYDEBUG
- if (yydebug)
- printf("yydebug: error recovery discarding state %d\n",
- *yyssp);
- #endif
- if (yyssp <= yyss) goto yyabort;
- --yyssp;
- --yyvsp;
- }
- }
- }
- else
- {
- if (yychar == 0) goto yyabort;
- #if YYDEBUG
- if (yydebug)
- {
- yys = 0;
- if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
- if (!yys) yys = "illegal-symbol";
- printf("yydebug: state %d, error recovery discards token %d (%s)\n",
- yystate, yychar, yys);
- }
- #endif
- yychar = (-1);
- goto yyloop;
- }
- yyreduce:
- #if YYDEBUG
- if (yydebug)
- printf("yydebug: state %d, reducing by rule %d (%s)\n",
- yystate, yyn, yyrule[yyn]);
- #endif
- yym = yylen[yyn];
- yyval = yyvsp[1-yym];
- switch (yyn)
- {
- case 4:
- #line 83 "make_func.y"
- { yyval.string = ""; }
- break;
- case 5:
- #line 85 "make_func.y"
- { yyval.string = yyvsp[0].string ; }
- break;
- case 6:
- #line 85 "make_func.y"
- { yyval.string ="0"; }
- break;
- case 7:
- #line 88 "make_func.y"
- {
- char buff[500];
- char f_name[500];
- int i;
- if (min_arg == -1)
- min_arg = yyvsp[-3].number ;
- if (yyvsp[-5].string [0] == '\0') {
- int len;
- if (strlen(yyvsp[-6].string ) + 1 + 2 > sizeof f_name)
- fatal("A local buffer was too small!(1)\n");
- sprintf(f_name, "F_%s", yyvsp[-6].string );
- len = strlen(f_name);
- for (i=0; i < len; i++) {
- if (islower(f_name[i]))
- f_name[i] = toupper(f_name[i]);
- }
- has_token[num_buff]=1;
- } else {
- if (strlen(yyvsp[-5].string ) + 1 > sizeof f_name)
- fatal("A local buffer was too small(2)!\n");
- strcpy(f_name, yyvsp[-5].string );
- has_token[num_buff]=0;
- }
- for(i=0; i < last_current_type; i++) {
- int j;
- for (j = 0; j+i<last_current_type && j < curr_arg_type_size; j++)
- {
- if (curr_arg_types[j] != arg_types[i+j])
- break;
- }
- if (j == curr_arg_type_size)
- break;
- }
- if (i == last_current_type) {
- int j;
- for (j=0; j < curr_arg_type_size; j++) {
- arg_types[last_current_type++] = curr_arg_types[j];
- if (last_current_type == NELEMS(arg_types))
- yyerror("Array 'arg_types' is too small");
- }
- }
- sprintf(buff, "{\"%s\",%s,%d,%d,%s,%s,%s,%d,%s},\n",
- yyvsp[-6].string , f_name, min_arg, limit_max ? -1 : yyvsp[-3].number , ctype(yyvsp[-7].number ),
- etype(0), etype(1), i, yyvsp[-2].string );
- if (strlen(buff) > sizeof buff)
- fatal("Local buffer overwritten !\n");
- key[num_buff] = (char *) malloc(strlen(yyvsp[-6].string ) + 1);
- strcpy(key[num_buff], yyvsp[-6].string );
- buf[num_buff] = (char *) malloc(strlen(buff) + 1);
- strcpy(buf[num_buff], buff);
- num_buff++;
- min_arg = -1;
- limit_max = 0;
- curr_arg_type_size = 0;
- }
- break;
- case 9:
- #line 144 "make_func.y"
- { yyval.number = yyvsp[-1].number | 0x10000; }
- break;
- case 17:
- #line 148 "make_func.y"
- { yyval.number = 0; }
- break;
- case 18:
- #line 149 "make_func.y"
- { yyval.number = 1; if (yyvsp[0].number ) min_arg = 0; }
- break;
- case 19:
- #line 150 "make_func.y"
- { yyval.number = yyvsp[-2].number + 1; if (yyvsp[0].number ) min_arg = yyval.number - 1; }
- break;
- case 20:
- #line 153 "make_func.y"
- {
- yyval.number = yyvsp[0].number ;
- curr_arg_types[curr_arg_type_size++] = 0;
- if (curr_arg_type_size == NELEMS(curr_arg_types))
- yyerror("Too many arguments");
- }
- break;
- case 21:
- #line 161 "make_func.y"
- {
- if (yyvsp[0].number != VOID) {
- curr_arg_types[curr_arg_type_size++] = yyvsp[0].number ;
- if (curr_arg_type_size == NELEMS(curr_arg_types))
- yyerror("Too many arguments");
- }
- yyval.number = yyvsp[0].number ;
- }
- break;
- case 22:
- #line 170 "make_func.y"
- { yyval.number = (yyvsp[0].number == VOID && min_arg == -1); }
- break;
- case 23:
- #line 171 "make_func.y"
- { yyval.number = (min_arg == -1 && (yyvsp[-2].number || yyvsp[0].number == VOID));}
- break;
- case 24:
- #line 172 "make_func.y"
- { yyval.number = min_arg == -1 ; limit_max = 1; }
- break;
- #line 782 "y.tab.c"
- }
- yyssp -= yym;
- yystate = *yyssp;
- yyvsp -= yym;
- yym = yylhs[yyn];
- if (yystate == 0 && yym == 0)
- {
- #ifdef YYDEBUG
- if (yydebug)
- printf("yydebug: after reduction, shifting from state 0 to\
- state %d\n", YYFINAL);
- #endif
- yystate = YYFINAL;
- *++yyssp = YYFINAL;
- *++yyvsp = yyval;
- if (yychar < 0)
- {
- if ((yychar = yylex()) < 0) yychar = 0;
- #if YYDEBUG
- if (yydebug)
- {
- yys = 0;
- if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
- if (!yys) yys = "illegal-symbol";
- printf("yydebug: state %d, reading %d (%s)\n",
- YYFINAL, yychar, yys);
- }
- #endif
- }
- if (yychar == 0) goto yyaccept;
- goto yyloop;
- }
- if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
- yystate = yytable[yyn];
- else
- yystate = yydgoto[yym];
- #ifdef YYDEBUG
- if (yydebug)
- printf("yydebug: after reduction, shifting from state %d \
- to state %d\n", *yyssp, yystate);
- #endif
- if (yyssp >= yyss + yystacksize - 1)
- {
- goto yyoverflow;
- }
- *++yyssp = yystate;
- *++yyvsp = yyval;
- goto yyloop;
- yyoverflow:
- yyerror("yacc stack overflow");
- yyabort:
- return (1);
- yyaccept:
- return (0);
- }
-